<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.ti_finance.*" %>
<%@page import="java.util.*" %>
<%@page import="com.lmpop.frame.util.PageTools" %>
<%@page import="com.lmpop.trade.ti_returnmoney.Ti_returnmoneyInfo"%>
<%@page import="com.lmpop.trade.ti_member.Ti_memberInfo"%>
<%

	request.setCharacterEncoding("UTF-8");
	String session_user_id="";
	if(session.getAttribute("session_user_id")!=null){
	  session_user_id=session.getAttribute("session_user_id").toString(); 
	}
	Map ti_returnmoney = new Hashtable();
	String s_cust_name = "";
	if(request.getParameter("s_cust_name")!=null && !request.getParameter("s_cust_name").equals("")){
		s_cust_name = request.getParameter("s_cust_name");
		ti_returnmoney.put("cust_name",s_cust_name);
	}
	String s_money_start = "";
	if(request.getParameter("s_money_start")!=null && !request.getParameter("s_money_start").equals("")){
		s_money_start = request.getParameter("s_money_start");
		ti_returnmoney.put("money_start",s_money_start);
	}	
	String s_money_end = "";
	if(request.getParameter("s_money_end")!=null && !request.getParameter("s_money_end").equals("")){
		s_money_end = request.getParameter("s_money_end");
		ti_returnmoney.put("money_end",s_money_end);
	}	
	String iStart = "0";
	int limit = 20;
	if(request.getParameter("iStart")!=null) iStart = request.getParameter("iStart");
	Ti_returnmoneyInfo returnmoneyInfo = new Ti_returnmoneyInfo();
	List list = returnmoneyInfo.getListByPage(ti_returnmoney,Integer.parseInt(iStart),limit);
	int counter = returnmoneyInfo.getCountByObj(ti_returnmoney);

	String pageString = new PageTools().getGoogleToolsBar(counter,"returnMoney.jsp?iStart=",Integer.parseInt(iStart),limit);
	Ti_memberInfo memberInfo=new Ti_memberInfo();
	
%>
<html>
  <head>
    
    <title>会员提现管理</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="/js/commen.js"></script>
	<script type="text/javascript" src="inter.js"></script>
</head>

<body>
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td width="90%">
				<h1>会员提现管理</h1>
			</td>
			<td>
				
			</td>
		</tr>
	</table>
	
	<form action="index.jsp" name="indexForm" method="post">
	  
	<table width="100%" cellpadding="0" cellspacing="0" class="dl_su">
		<tr>
			<td align="left" >
				按会员名称：<input type="text" value="" name="s_cust_name" id="s_cust_name" maxlength="50" class="input" />
				按提现金额：<input type="text" value="" name="s_money_start" id="s_money_start" maxlength="10" class="input" />
				-<input type="text" value="" name="s_money_end" id="s_money_end" maxlength="10" class="input" />
				<input name="searchInfo" type="button" value="搜索" onclick="seacher();"/>
			</td>
		</tr>
	</table>

	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<% 
		int listsize = 0;
		if(list!=null && list.size()>0){
			listsize = list.size();
	%>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
				
			</td>
			<td>
				总数:<%=counter %>条
			</td>
		</tr>
	</table>
	
	<table width="100%" cellpadding="1" cellspacing="1" class="listtab" border="0">
		<tr>
			<th align="center">会员名称</th>
		  	<th align="center">提现金额</th>
		  	<th align="center">收款账号</th>
		  	<th align="center">收款银行</th>
		  	<th align="center">申请时间</th>
		  	<th align="center">收款时间</th>
		  	<th align="center">当前状态</th>
			<th  align="center">操作</th>
		</tr>
		
	<% 
		  		for(int i=0;i<list.size();i++){
		  			Hashtable map = (Hashtable)list.get(i);
		  			String trade_id="",cust_id="",use_vmoney="",bank_no="",bank_name="",
		  			return_state="",return_time="",create_time="";
	  			  	if(map.get("trade_id")!=null) trade_id = map.get("trade_id").toString();
					if(map.get("cust_id")!=null) cust_id = map.get("cust_id").toString();
					if(map.get("use_vmoney")!=null) use_vmoney = map.get("use_vmoney").toString();
					if(map.get("bank_no")!=null) bank_no = map.get("bank_no").toString();
					if(map.get("bank_name")!=null) bank_name = map.get("bank_name").toString();
					if(map.get("create_time")!=null) create_time = map.get("create_time").toString();
					if(create_time.length()>19)create_time=create_time.substring(0,19);
					if(map.get("return_time")!=null) return_time = map.get("return_time").toString();
					if(return_time.length()>19)return_time=return_time.substring(0,19);
					if(map.get("return_state")!=null) return_state = map.get("return_state").toString();

		  %>
		
		<tr>
			
			  <td align="center"><%=memberInfo.getCustNameByPk(cust_id)%></td>
			  <td align="center"><%=use_vmoney%></td>
			  <td align="center"><%=bank_no%></td>
			  <td align="center"><%=bank_name%></td>
			  <td align="center"><%=create_time%></td>
			  <td align="center"><%=return_time%></td>
			  <td align="center">
			  	<%
			  		if(return_state.equals("0"))
			  			out.print("正在处理");
			  		if(return_state.equals("1"))
			  			out.print("提现成功");
			  		if(return_state.equals("2"))
			  			out.print("提现失败");
			  	%>
			  </td>
		  	
			<td align="center">
				<%
					if(return_state.equals("0")){%>
						<a href="#" onclick="returnMoney('<%=trade_id %>','<%=cust_id %>','<%=use_vmoney %>','1')">成功</a>&nbsp;|&nbsp;
						<a href="#" onclick="returnMoney('<%=trade_id %>','<%=cust_id %>','<%=use_vmoney %>','2')">失败</a>
					<%}else{
						out.print("处理结束");
					}
				 %>

			</td>
		</tr>
		
		  <%
		  		}
		  %>
		
	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
				
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<%
		 }
	%>
	
	  </form>
	 
	 <form action="/doTradeReg.do" method="post" name="returnMoneyForm">
	 	<input type="hidden" name="bpm_id" value="5889" />
	 	<input type="hidden" name="trade_id" id="trade_id"  />
	 	<input type="hidden" name="cust_id" id="cust_id"  />
	 	<input type="hidden" name="return_state" id="return_state"  />
	 	<input type="hidden" name="use_vmoney" id="use_vmoney"  />
	 	<input type="hidden" name="oper_userid" id="oper_userid" value="<%=session_user_id %>" />
	 	
	 </form>
</body>

</html>
